﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.Geodatabase;
using System.Runtime.InteropServices;

namespace hzGis.utils
{
   public class MemoryHelper
    {
       public static void ReleaseFeatureClass(IFeatureClass pFeatureClass)
       {
           IWorkspace myWorkspace = (pFeatureClass as IDataset).Workspace;
           IWorkspaceFactory myWorkspaceFactory = myWorkspace.WorkspaceFactory;
           Marshal.ReleaseComObject(pFeatureClass);
           IWorkspaceFactoryLockControl myWorkspaceFactoryLockControl = myWorkspaceFactory as IWorkspaceFactoryLockControl;
           if (myWorkspaceFactoryLockControl.SchemaLockingEnabled)
           {
               myWorkspaceFactoryLockControl.DisableSchemaLocking();
           }
       }
    }
}
